<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="keywords" content=""/>
	<title>{$title}</title>
	<link rel="stylesheet" type="text/css" href="css/base.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<script src="js/jquery.min.js"></script>
</head>
<style type="text/css">
.demo{width:760px; height:120px; margin:10px auto;}
.wrap{width:90px; height:90px; /*margin:120px auto 30px auto;*/ position:relative}
.dice{width:90px; height:90px; background:url(../style/playstyle/Sieve/dice.png) no-repeat; cursor:pointer;}
.dice_1{background-position:-5px -4px}
.dice_2{background-position:-5px -107px}
.dice_3{background-position:-5px -212px}
.dice_4{background-position:-5px -317px}
.dice_5{background-position:-5px -427px}
.dice_6{background-position:-5px -535px}
.dice_t{background-position:-5px -651px}
.dice_s{background-position:-5px -763px}
.dice_e{background-position:-5px -876px}
p#result{text-align:center; font-size:16px}
p#result span{font-weight:bold; color:#f30; margin:6px}
#dice_mask{width:90px; height:90px; background:#fff; opacity:0; position:absolute; top:0; left:0; z-index:999}

</style>

<script type="text/javascript">
$(function(){
	var dice = $("#dice");
	dice.click(function(){;
		$(".wrap").append("<div id='dice_mask'></div>");//加遮罩
		dice.attr("class","dice");//清除上次动画后的点数
		dice.css('cursor','default');
		
		$.ajax({
	       url: '{$_url}/player/sieve.php',
	       type: "post",
	       data:null,
	       dataType: "json",
	       // dataType: "text",
	       cache: false,
	       error: function(){//出错
	            alert('积分不足'); return false;
	        },
	        success: function(res){//成功
	            if(typeof(res.award_id)!='undefined'){
	               award_id = res.award_id;//得到奖品ID
	               award_name = res.award_name;//得到奖品名称
	               var  num = res.award_id;//点数
	                dice.animate({left: '+2px'}, 100,function(){
	        			dice.addClass("dice_t");
	        		}).delay(200).animate({top:'-2px'},100,function(){
	        			dice.removeClass("dice_t").addClass("dice_s");
	        		}).delay(200).animate({opacity: 'show'},600,function(){
	        			dice.removeClass("dice_s").addClass("dice_e");
	        		}).delay(100).animate({left:'-2px',top:'2px'},100,function(){
	        			dice.removeClass("dice_e").addClass("dice_"+num);
	        			//$("#result").html("您掷得点数是<span>"+num+"</span>");
	        			dice.css('cursor','pointer');
	        			$("#dice_mask").remove();//移除遮罩
	        			if(award_name){
			            	alert(award_name);
			            }else{
			            	alert('非常遗憾,为什么每次离大奖都是那么得近，又是那么得远！');
			            }
	        		});
	            }else{
	                alert(res);
	            }
	        }
	    });
	});
});
</script>

</head>
<body>
	<!--容器-->
	<div class="container">
		<!--内容-->
		<div class="content activity_game_dicing">
			<!--游戏-->
			<div>
				<div class="f_l relative">
				
				<!-- 游戏开始 -->
			   		<div class="wrap" id="activity_game_dicingDetail">
			   			<div id="dice" class="dice dice_1"></div>
			        </div>
				<!-- 游戏结束 -->
				
					<img src="{$style}/images/game3.png" height="auto" width="100%" alt="" class="f_l">
				</div>
				<div class="f_l">
					<div class="f_l activity_dicing_bg">
						<img src="{$style}/images/game_dicing_descBg.png" height="264" width="720" alt="">
					</div>
					<div class="f_l activity_dicing_desc">
						<div class="activity_dicing_score">一次游戏消费{$rs['jifen']}个活动积分</div>
						<div class="activity_dicing_btn">点击色子抽奖</div>
						<div class="activity_dicing_record">
							<a href="/?act=activity&met=activity_record">我的游戏记录</a>
						</div>
					</div>
					<div class="qfd"></div>
				</div>
				<div class="qfd"></div>
			</div>
			<!--游戏结束-->
			<!--游戏奖品-->
			<div class="activity_dicing_rule">
				<!--标题-->
				<div class="activity_dicing_title">
					<div class="activity_dicing_titBg">游戏奖品</div>
				</div>
				<!--标题结束-->
				<!--列表-->
				<div class="activity_dicing_list">
					<ul>
						{$rs['jiangpin']}
					</ul>
				</div>
			</div>
			<!--游戏奖品结束-->
			<!--游戏规则-->
			<div class="activity_dicing_rule">
				<!--标题-->
				<div class="activity_dicing_title">
					<div class="activity_dicing_titBg">游戏规则</div>
				</div>
				<!--标题结束-->
				<!--列表-->
				<div class="activity_dicing_list">
					<ul>
						{$rs['guize']}
					</ul>
				</div>
			</div>
			<!--游戏规则结束-->
			{if(@$winn)}
			<!--中奖名单-->
			<div class="activity_dicing_prize">
				<!--标题-->
				<div class="activity_dicing_title">
					<div class="activity_dicing_titBg">中奖名单</div>
				</div>
				<!--标题结束-->
				<!--列表-->
				<div class="activity_prize_dicing">
					<ul>
						{foreach($winn as $k=>$v1)}
						<li>
							<div class="f_l">恭喜{code(echo substr_replace($v1['phone'],'****',3,4))}</div>
							<div class="f_l">抽中{$v1['jiangpin']}</div>
							<div class="f_l">{if(time() - $v1['time'] < 60)}刚刚
					         {elseif(time() - $v1['time'] < 60*60)}{code(echo floor((time() - $v1['time'])/60))}分钟前
					         {elseif(time() - $v1['time'] < 60*60*12)}{code(echo floor((time() - $v1['time'])/(60*60)))}小时前
					         {else}{code(echo date('m-d H:i',$v1['time']))}{/if}</div>
							<div class="qfd"></div>
						</li>
					    {/foreach}
					</ul>
				</div>
				<!--列表结束-->
			</div>
			<!--中奖名单结束-->
			{/if}
		</div>
		<!--内容结束-->
	</div>
	<!--容器结束-->
</body>
</html>